/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package simplemetrosystem.model.Command.EditCommand;

import simplemetrosystem.control.ElementManager;
import simplemetrosystem.model.Command.Command;
import simplemetrosystem.model.Element.MetroString;

/**
 *
 * @author Eric Qian
 */
public class AddStringCommand implements Command {

    public AddStringCommand(String text, String element, int logX, int logY) {
        this.text = text;
        this.element = element;
        this.logX = logX;
        this.logY = logY;
    }
    
    public void execute() {
        string = ElementManager.getInstance().addString(text, element, logX, logY);
    }

    public void undo() {
        if(string != null){
            ElementManager.getInstance().removeString(string);
        }
    }
    private MetroString string;
    private String text;
    private String element;
    private int logX;
    private int logY;
}
